pub fn new_birthday_probability(n: u32) -> f64 {
    if n < 2 {
        panic!("Number of people must be at least 2");
    }
    let days_in_year = 365;
    let mut prob_no_shared = 1.0;

    // 计算没有人生日相同的概率
    for i in 0..n {
        prob_no_shared *= (days_in_year - i) as f64 / days_in_year as f64;
    }

    // 至少两人生日相同的概率
    let prob_shared = 1.0 - prob_no_shared;

    // 保留四位小数
    (prob_shared * 10_000.0).round() / 10_000.0
}

